package traveldream.ejb.entities;

import java.io.Serializable;

import javax.persistence.*;

import traveldream.ejb.DTO.PackageDTO;


/**
 * The persistent class for the customized_package database table.
 * 
 */
@Entity
@Table(name="customized_package")
@NamedQuery(name="CustomizedPackage.findAll", query="SELECT c FROM CustomizedPackage c WHERE c.invalid = false")
public class CustomizedPackage implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	private int id;

	private String description;

	@ManyToOne
	@JoinColumn(name="`Email Customer`")
	private User email_Customer;

	@ManyToOne
	@JoinColumn(name="`Id Arrival Transport`")
	private TransportationMean Arrival_Transport;

	@ManyToOne
	@JoinColumn(name="`Id Departure Transport`")
	private TransportationMean Departure_Transport;

	@ManyToOne
	@JoinColumn(name="`Id Excursion`")
	private Excursion Excursion;

	@ManyToOne
	@JoinColumn(name="`Id Hotel`")
	private Hotel hotel;

	private String name;

	private String nation;

	private int price;
	
	@Column(name="`Invalid`")
	private boolean invalid;

	public CustomizedPackage() {
	}
	
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	
	public User getEmail_Customer() {
		return email_Customer;
	}

	public void setEmail_Customer(User email_Customer) {
		this.email_Customer = email_Customer;
	}

	public TransportationMean getArrival_Transport() {
		return Arrival_Transport;
	}

	public void setArrival_Transport(TransportationMean arrival_Transport) {
		Arrival_Transport = arrival_Transport;
	}

	public TransportationMean getDeparture_Transport() {
		return Departure_Transport;
	}

	public void setDeparture_Transport(TransportationMean departure_Transport) {
		Departure_Transport = departure_Transport;
	}

	public Excursion getExcursion() {
		return Excursion;
	}

	public void setExcursion(Excursion excursion) {
		Excursion = excursion;
	}

	public Hotel getId_Hotel() {
		return hotel;
	}

	public void setId_Hotel(Hotel id_Hotel) {
		this.hotel = id_Hotel;
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getNation() {
		return this.nation;
	}

	public void setNation(String nation) {
		this.nation = nation;
	}

	public int getPrice() {
		return this.price;
	}

	public void setPrice(int price) {
		this.price = price;
	}
	
	
	public Hotel getHotel() {
		return hotel;
	}

	public void setHotel(Hotel hotel) {
		this.hotel = hotel;
	}

	public boolean isInvalid() {
		return invalid;
	}

	public void setInvalid(boolean invalid) {
		this.invalid = invalid;
	}

	public PackageDTO convertToDTO(){
		PackageDTO pDTO = new PackageDTO();
	    pDTO.setDescription(description);
    	pDTO.setId(id);
    	pDTO.setName(name);
    	pDTO.setNation(nation);
    	pDTO.setPrice(price);
    	pDTO.setIdReturn(Arrival_Transport.getId());
    	pDTO.setIdGoing(Departure_Transport.getId());
    	pDTO.setIdExcursion(Excursion.getId());
    	pDTO.setIdHotel(hotel.getId());
    	return pDTO;
    }
	    

}